package leetcode.leetcode16xx.leetcode1655;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

class SolutionTest {

    @Test
    void test1() {
        int[] nums = {1, 2, 3, 4};
        int[] quantity = {2};
        assertFalse(new Solution().canDistribute(nums, quantity));
    }

    @Test
    void test2() {
        int[] nums = {1, 2, 3, 3};
        int[] quantity = {2};
        assertTrue(new Solution().canDistribute(nums, quantity));
    }

    @Test
    void test3() {
        int[] nums = {1, 1, 2, 2};
        int[] quantity = {2, 2};
        assertTrue(new Solution().canDistribute(nums, quantity));
    }

    @Test
    void test4() {
        int[] nums = {1, 1, 2, 3};
        int[] quantity = {2, 2};
        assertFalse(new Solution().canDistribute(nums, quantity));
    }

    @Test
    void test5() {
        int[] nums = {1, 1, 1, 1, 1};
        int[] quantity = {2, 3};
        assertTrue(new Solution().canDistribute(nums, quantity));
    }

    @Test
    void test6() {
        int[] nums = {586, 667, 823, 667, 801, 49, 669, 120, 49, 163, 669, 712, 163, 823, 801, 163, 712, 120, 667, 669, 801, 667, 586, 801, 801, 667, 163, 823, 586, 801, 667, 49, 120, 49, 163, 712, 49, 163, 667, 163, 163, 586, 712, 49, 120, 667, 801, 49, 667, 667, 49, 712, 712, 120, 586, 801, 49, 669, 667, 49, 823, 49, 712, 823, 801, 801, 49, 120, 669, 669, 712, 823, 120, 801, 163, 49, 163, 667, 586, 586, 49, 586, 163, 667, 163, 163, 163, 163, 823, 667, 712, 586, 823, 667, 823, 163, 49, 120, 801, 801, 49, 823, 586, 49, 801, 120, 586, 667, 669, 823, 801, 669, 669, 49, 823, 669, 823, 712, 163, 163, 120, 669, 712, 669, 667, 667, 801, 801, 669, 667, 163, 49, 823, 667, 801, 823, 49, 163, 801, 120, 667, 120, 120, 801, 163, 669, 586, 823, 823, 669, 712, 163, 823, 667, 823, 120, 712, 712, 823, 823, 667, 49, 801, 120, 120, 667, 801, 667, 163, 669, 801, 712, 120, 801, 120, 669, 667, 667, 120, 823, 163, 823, 712, 586, 163, 712, 163, 120, 163, 120, 823, 49, 49, 120, 586, 120, 712, 801, 669, 49, 120, 801, 120, 823, 163, 712, 712, 669, 667, 667, 669, 120, 49, 823, 823, 120, 586, 586, 801, 823, 49, 712, 49, 669, 712, 669, 667, 712, 823, 120, 49, 49, 712, 586, 667, 712, 801, 667, 163, 163, 712, 120, 801, 49, 586, 801, 667, 712, 49, 163, 586, 586, 823, 801, 49, 801, 669, 163, 823, 586, 667, 801, 586, 120, 120, 823, 163, 163, 712, 669, 49, 667, 667, 823, 712, 120, 801, 586, 712, 669, 163, 669, 712, 586, 49, 669, 712, 120, 712, 120, 49, 801, 163, 801, 712, 120, 801, 823, 712, 712, 712, 667, 49, 49, 49, 120, 801, 667, 163, 120, 801, 712, 823, 163, 801, 669, 712, 823, 120, 823, 586, 120, 120, 801, 667, 49, 712, 120, 669, 669, 669, 445, 49, 712, 712, 667, 163, 163, 669, 712, 669, 669, 120, 667, 120, 120, 49, 120, 669, 669, 667, 49, 801, 823, 586, 823, 823, 163, 823, 163, 120, 823, 667, 586, 823, 823, 49, 823, 667, 801, 823, 667, 667, 163, 667, 801, 120, 163, 712, 801, 669, 163, 823, 163, 49, 667, 49, 667, 163, 163, 49, 120, 667, 823, 801, 823, 712, 120, 823, 49, 586, 712, 669, 586, 49, 586, 586, 586, 163, 801, 163, 801, 801, 163, 669, 586, 712, 49, 801, 801, 669, 667, 49, 163, 120, 163, 120, 669, 669, 823, 712, 823, 823, 586, 801, 712, 49, 120, 667, 163, 712, 712, 669, 801, 163, 49, 49, 667, 823, 823, 49, 586, 669, 586, 586, 586, 801, 801, 667, 801, 669, 49, 801, 801, 712, 823, 801, 823, 669, 667, 163, 712, 669, 823, 801, 120, 669, 667, 163, 49, 712, 712, 669, 120, 712, 712, 669, 586, 667, 163, 801, 801, 667, 667, 163, 823, 801, 586, 823, 667, 823, 801, 120, 586, 586, 801, 49, 823, 823, 586, 49, 120, 801, 669, 163, 120, 669, 49, 667, 49, 120, 120, 712, 823, 120, 801, 712, 669, 120, 669, 712, 120, 823, 801, 120, 163, 801, 712, 712, 49, 667, 163, 586, 120, 586, 120, 120, 49, 586, 669, 801, 669, 712, 823, 586, 823, 120, 801, 669, 823, 712, 823, 712, 586, 823, 712, 801, 667, 49, 120, 586, 49, 163, 49, 712, 669, 586, 669, 49, 712, 586, 163, 667, 712, 823, 49, 667, 586, 49, 120, 667, 823, 801, 801, 823, 667, 163, 163, 586, 667, 669, 586, 669, 120, 586, 586, 712, 667, 801, 712, 586, 163, 801, 667, 586, 801, 49, 823, 586, 801, 712, 667, 823, 669, 49, 669, 120, 712, 712, 120, 163, 586, 669, 823, 823, 163, 823, 667, 823, 801, 823, 823, 49, 163, 712, 120, 120, 801, 801, 823, 801, 669, 712, 823, 49, 120, 823, 586, 120, 801, 163, 669, 120, 120, 712, 823, 823, 801, 120, 712, 712, 120, 586, 712, 667, 801, 49, 163, 669, 667, 669, 712, 669, 163, 120, 823, 49, 712, 712, 49, 586, 712, 49, 586, 163, 669, 823, 120, 163, 712, 823, 586, 669, 801, 823, 120, 801, 163, 49, 120, 120, 801, 669, 667, 823, 801, 120, 163, 712, 586, 49, 823, 586, 669, 49, 669, 669, 49, 712, 801, 120, 49, 801, 667, 120, 712, 667, 801, 823, 667, 586, 163, 667, 801, 586, 120, 669, 712, 49, 669, 669, 669, 667, 712, 163, 823, 49, 801, 801, 163, 586, 586, 667, 823, 120, 669, 801, 49, 586, 712, 667, 823, 586, 801, 163, 163, 120, 586, 667, 712, 801, 120, 120, 163, 120, 712, 712, 667, 712, 801, 667, 712, 586, 586, 801, 667, 163, 49, 586, 120, 669, 586, 669, 801, 801, 712, 823, 163, 712, 667, 667, 667, 801, 801, 49, 669, 586, 823, 823, 163, 49, 823, 49, 823, 163, 712, 586, 586, 586, 667, 801, 667, 667, 49, 823, 586, 120, 120, 667, 823, 120, 163, 667, 586, 801, 586, 163, 712, 801, 49, 586, 669, 667, 586, 586, 669, 801, 667, 801, 163, 120, 120, 49, 669, 801, 669, 49, 49, 163, 712, 163, 669, 163, 120, 586, 669, 669, 667, 49, 120, 120, 801, 712, 586, 586, 120, 669, 163, 586, 49, 163, 823, 823, 801, 163, 49, 801, 667, 669, 667, 49, 120, 586, 823, 120, 667, 669, 712, 712, 712, 120, 669, 669, 823, 712, 712, 823, 801, 669, 163, 120, 823, 163, 667, 49, 163, 49, 801, 586, 667, 823, 120, 586, 163, 49, 823, 712, 712, 667, 120, 667, 801, 667, 120, 163, 120, 801, 823, 669, 586, 823, 801, 801, 669, 667, 823, 120, 712, 801, 667, 823, 120, 667, 586, 163, 49, 712, 712, 667, 586, 586, 667, 823, 163, 49, 667, 667, 667, 120, 49, 49, 712, 163, 801, 120, 823, 667, 667, 823, 823, 120, 586, 712, 120, 712, 669, 712, 667, 120, 801, 801, 120, 667, 712, 586, 586, 712, 669, 823, 801, 667, 163, 163, 667, 801, 712, 669, 120, 712, 667, 49, 120, 49, 823, 120, 586, 49, 801, 801, 120, 49, 163, 586, 667, 586, 712, 49, 49, 712, 163, 49, 49, 667, 120, 49, 823, 667, 669, 669, 49, 669, 669, 823, 163, 712, 586, 586, 586, 669, 120, 669, 712, 120, 823, 823, 669, 163, 586, 586, 163, 823, 823, 712, 49, 49, 801, 823, 669, 586, 163, 586, 120, 49, 163, 586, 712, 586, 163, 801, 712, 712, 823, 712, 823, 49, 667, 669, 801, 120, 712, 712, 120, 669, 801, 667, 669, 667, 586, 823, 669, 49, 667, 586, 667, 49, 586, 801, 823, 669, 163, 669, 120, 801, 120, 823, 667, 712, 667, 163, 669, 801, 586, 801, 49, 586, 49, 49, 163, 712, 586, 49, 667, 712, 49, 586, 120, 823, 586, 667, 163, 49, 669, 712, 586, 801, 586, 667, 823, 163, 712, 586, 49, 801, 712, 669, 49, 163, 669, 49, 823, 823, 49, 801, 586, 163, 823, 669, 120, 669, 801, 163, 667, 49, 712, 669, 801, 667, 120, 586, 801, 586, 823, 801, 163, 586, 163, 667, 712, 667, 49, 586, 801, 120, 586, 163, 120, 163, 49, 586, 586, 163, 163, 586, 120, 586, 669, 586, 801, 823, 823, 801, 669, 667, 586, 49, 163, 163, 712, 712, 801, 667, 120, 823, 667, 667, 669, 669, 163, 669, 712, 823, 120, 163, 586, 163, 120, 586, 667, 667, 163, 712, 120, 801, 801, 586, 163, 669, 801, 823, 667, 669, 712, 801, 712, 120, 801, 669, 669, 120, 667, 823, 712, 120, 667, 823, 586, 823, 49, 712, 667, 801, 712, 667, 49, 669, 801, 669, 163, 120, 120, 667, 669, 669, 49, 669, 120, 120, 49, 669, 120, 667, 120, 586, 163, 669, 667, 712, 163, 667, 712, 823, 669, 823, 712, 669, 669, 669, 669, 49, 163, 823, 163, 669, 586, 823, 120, 712, 49, 801, 667, 669, 823, 667, 586, 667, 712, 801, 49, 163, 120, 163, 49, 823, 120, 49, 586, 823, 586, 163, 586, 823, 712, 801, 801, 163, 49, 163, 163, 669, 49, 823, 823, 823, 669, 667, 669, 163, 163, 163, 712, 712, 712, 667, 669, 669, 801, 586, 801, 586, 712, 49, 586, 801, 667, 49, 667, 669, 586, 823, 163, 669, 669, 801, 669, 801, 712, 712, 669, 120, 667, 586, 667, 712, 586, 712, 120, 712, 801, 120, 163, 120, 49, 586, 669, 667, 667, 163, 823, 586, 667, 823, 801, 586, 163, 163, 712, 669, 667, 586, 163, 120, 712, 120, 712, 120, 823, 586, 586, 163, 801, 712, 823, 823, 120, 669, 712, 49, 669, 49, 667, 49, 49, 669, 120, 120, 823, 669, 669, 667, 712, 586, 586, 712, 49, 667, 712, 586, 667, 801, 823, 667, 669, 801, 712, 49, 667, 801, 669, 49, 163, 801, 669, 801, 120, 801, 49, 163, 669, 667, 823, 120, 586, 823, 120, 120, 823, 823, 669, 586, 586, 49, 163, 823, 49, 669, 667, 49, 120, 801, 669, 667, 823, 823, 801, 667, 586, 712, 120, 801, 586, 667, 669, 49, 712, 667, 823, 667, 801, 586, 667, 586, 669, 801, 712, 669, 667, 586, 669, 667, 801, 712, 712, 49, 669, 586, 120, 163, 669, 163, 120, 669, 586, 586, 823, 586, 823, 712, 163, 120, 823, 801, 712, 712, 49, 823, 801, 669, 163, 801, 586, 801, 823, 120, 712, 120, 120, 669, 667, 586, 49, 120, 667, 49, 49, 667, 120, 586, 120, 801, 823, 163, 163, 49, 163, 49, 120, 163, 163, 801, 667, 49, 712, 163, 712, 801, 586, 120, 712, 49, 712, 49, 163, 823, 163, 49, 163, 669, 823, 49, 801, 669, 586, 823, 669, 163, 49, 667, 712, 120, 801, 801, 667, 586, 823, 49, 669, 120, 823, 712, 49, 586, 823, 823, 120, 49, 163, 163, 667, 823, 49, 669, 712, 712, 49, 823, 120, 163, 667, 49, 669, 667, 823, 586, 163, 163, 120, 586, 801, 801, 801, 712, 586, 586, 586, 823, 120, 669, 669, 801, 823, 120, 120, 823, 586, 712, 586, 712, 823, 163, 712, 823, 163, 801, 669, 669, 163, 586, 49, 163, 712, 163, 801, 712, 49, 801, 667, 120, 163, 120, 669, 667, 667, 823, 49, 801, 823, 801, 669, 801, 49, 49, 120, 49, 120, 49, 823, 49, 120, 667, 49, 586, 823, 49, 120, 712, 586, 801, 586, 712, 49, 586, 801, 712, 163, 120, 712, 163, 667, 120, 163, 163, 801, 163, 669, 586, 801, 163, 49, 667, 669, 586, 586, 163, 586, 49, 163, 586, 712, 669, 823, 823, 49, 669, 712, 586, 669, 49, 120, 163, 712, 49, 667, 120, 712, 823, 823, 669, 120, 667, 801, 586, 667, 801, 49, 712, 586, 49, 586, 801, 669, 163, 120, 823, 49, 712, 163, 667, 712, 823, 667, 669, 49, 163, 163, 586, 801, 667, 586, 120, 823, 801, 667, 120, 163, 669, 586, 823, 669, 586, 120, 712, 801, 49, 586, 823, 120, 163, 586, 823, 586, 823, 49, 586, 669, 669, 667, 163, 669, 801, 49, 586, 712, 667, 667, 667, 823, 667, 712, 669, 49, 120, 667, 712, 667, 667, 712, 801, 120, 669, 163, 712, 163, 120, 163, 49, 669, 823, 586, 163, 667, 49, 823, 823, 49, 120, 712, 163, 120, 823, 823, 667, 667, 120, 586, 669, 801, 49, 120, 163, 669, 823, 669, 669, 712, 669, 823, 120, 712, 49, 801, 49, 120, 712, 667, 120, 586, 586, 712, 801, 669, 163, 163, 801, 667, 801, 163, 669, 120, 586, 163, 667, 823, 163, 801, 586, 801, 120, 667, 712, 669, 667, 163, 667, 823, 667, 120, 49, 586, 49, 712, 586, 586, 49, 49, 163, 669, 712, 801, 120, 712, 712, 163, 163, 669, 120, 801, 49, 801, 801, 823, 163, 163, 49, 120, 49, 669, 801, 586, 801, 163, 586, 669, 120, 801, 712, 801, 801, 163, 823, 669, 120, 49, 163, 163, 49, 163, 49, 120, 49, 49, 667, 49, 667, 801, 669, 667, 667, 669, 49, 669, 586, 586, 712, 120, 669, 823, 163, 163, 586, 823, 586, 801, 669, 586, 667, 163, 49, 49, 712, 120, 49, 823, 712, 120, 712, 823, 669, 163, 669, 667, 669, 49, 163, 445, 823};
        int[] quantity = {200, 201, 202, 203, 204, 205, 206, 207, 208, 209};
        assertFalse(new Solution().canDistribute(nums, quantity));
    }

    @Test
    void test7() {
        int[] nums = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50};
        int[] quantity = {10, 10, 10, 10, 10, 10, 10, 10, 10, 50};
        assertFalse(new Solution().canDistribute(nums, quantity));
    }
}